﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ModbusTestTool.Singeltons;

namespace ModbusTestTool.UI
{
    public partial class TCPpanel : UserControl
    {
        public TCPpanel()
        {
            InitializeComponent();
            textBox1.Text = Settings.Instance.State.address;
            textBox2.Text = Settings.Instance.State.port.ToString() ;
        }

        private void Save_Click(object sender, EventArgs e)
        {
            Settings.Instance.State.serialOrTcpSelect = Settings.serialOrTcp.tcp;
            Settings.Instance.State.address = textBox1.Text;
            Settings.Instance.State.port = Int32.Parse(textBox2.Text);
            Settings.Instance.SaveCurrentState();
            Settings.Instance.SetupModbusPorts();
        }
    }
}
